package com.mailanalyzer;

import java.util.List;

import javax.mail.Message;

import com.mailanalyzer.analyzer.impl.RyanairAnalyzer;
import com.mailanalyzer.core.Dispatcher;
import com.mailanalyzer.retrievers.Retriever;
import com.mailanalyzer.retrievers.impl.GmailRetriever;

/**
 * 
 * @author anibal.kolker
 *
 */
public class MailAnalyzer {

	public static void main(String[] args) {

		MailAnalyzer application = new MailAnalyzer();
		application.start();
	}

	//
	public void start(){
		try{
			Retriever retriever = new GmailRetriever();
			Message[] mails = retriever.retrieve();
			
			Dispatcher dispatcher = new Dispatcher();
			
			dispatcher.addAnalyzer(new RyanairAnalyzer());
			
			dispatcher.process(mails);
			
		}
		catch(Exception e){
			System.out.println("There was an exception");
			e.printStackTrace();
		}
		
	}
	
	
}
